package cn.lucky.springcloud.client;

import org.springframework.stereotype.Component;

/**
 * @author lingpeng.jiang
 * @create 2020-12-30-22:32 统一服务降级
 */
@Component
public class OpenfeignHystrixClientFallBackHandle implements OpenfeignHystrixClient {
    /**
     * 正常访问
     *
     * @param id
     * @return
     */
    @Override
    public String hystrixPaymentInfo_OK(Integer id) {
        return "提供者服务挂了,请稍后再重试,hystrixPaymentInfo_OK-------o(╥﹏╥)o";
    }

    /**
     * 超时访问
     *
     * @param id
     * @return
     */
    @Override
    public String hystrixPaymentInfo_Timeout(Integer id) {
        return "提供者服务挂了,请稍后再重试,hystrixPaymentInfo_Timeout-------o(╥﹏╥)o";
    }

    /**
     * 测试熔断
     *
     * @param id
     * @return
     */
    @Override
    public String circuitBreaker(Integer id) {
        return "服务进行熔断了,原因为ID：" + id;
    }

    @Override
    public String getServerPort() {
        return "提供者服务挂了,请稍后再重试,getServerPort";
    }
}
